package com.ldy.core.common;
//package com.ldy.mowan.common;
//
//import java.io.IOException;
//
//import javax.servlet.Filter;
//import javax.servlet.FilterChain;
//import javax.servlet.FilterConfig;
//import javax.servlet.ServletException;
//import javax.servlet.ServletRequest;
//import javax.servlet.ServletResponse;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.springframework.stereotype.Component;
//
//@Component
//public class BaseFilter implements Filter {
//	@Override
//	public void init(FilterConfig filterConfig) throws ServletException {
//		System.out.println("init=======");
//	}
//
//	@Override
//	public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
//			throws IOException, ServletException {
//		HttpServletRequest request = (HttpServletRequest) servletRequest;
//		HttpServletResponse response = (HttpServletResponse) servletResponse;
//		response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));// 支持跨域请求
//		response.setHeader("Access-Control-Allow-Headers",
//				"Authorization, Origin, X-Requested-With, Content-Type, Accept,Access-Token");
//		response.setHeader("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS,PATCH");
//		response.setHeader("Access-Control-Allow-Credentials", "true");// 是否支持cookie跨域
//		filterChain.doFilter(servletRequest, servletResponse);
//	}
//
//	@Override
//	public void destroy() {
//
//	}
//}